package com.group01.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.group01.pojo.Category;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
* @author 19559
* @description 针对表【es_category(分类表)】的数据库操作Mapper
* @createDate 2024-06-21 15:33:03
* @Entity com.group01.pojo.Category
*/
public interface CategoryMapper extends MPJBaseMapper<Category> {

    // 检查id
    @Select("select count(*) from es_category where id = #{categoryId}")
    Integer checkCategoryId(Integer categoryId);

    // 检查分类名
    @Select("select count(*) from es_category where name = #{categoryName} and id != #{id}")
    Integer checkCategoryName(@Param("categoryName") String categoryName, @Param("id") Integer id);

    // 检查父级分类是否存在
    @Select("select count(*) from es_category where id = #{parentId}")
    Integer checkParentId(Integer parentId);
}




